import { createStore } from "vuex";
export default createStore({
    state: {
        isCollapse: false,
        currentMenu: null,
        tabsList:[],
        userInfo: {},
        roleId: -1,
        routes: [] // 路由信息存储在这里
    },
    mutations: {
        updateIsCollpase(state,payload){
            state.isCollapse = !state.isCollapse
        },
        updateUserInfo(state,payload){
            state.userInfo = payload
        },
        updateRoleId(state,payload){
            state.roleId = payload
        },
        setRoutes(state, routes) {
            state.routes = routes;
          },
      },
     actions: {
        saveRoutes({ commit }, routes) {
          commit('setRoutes', routes);
        }
      },
    getters: {
        //获取 tabs
        getUserInfo(state) {
            return state.userInfo
        }
      }
})